import { Component, OnInit } from '@angular/core';
import {filter} from "rxjs/operators"
import { Router, NavigationEnd } from '@angular/router';

@Component({
  selector: 'app-content',
  templateUrl: './content.component.html',
  styleUrls: ['./content.component.css']
})
export class ContentComponent implements OnInit {
  
  pageTitle:string = "首页";
  pageDesc:string ="这里是首页";
  constructor(public router:Router) { 
    router.events.pipe(filter(event => event instanceof NavigationEnd))
    .subscribe((event:NavigationEnd) =>{
      if(event.url == '/dashboard'){
        this.pageTitle = '这里是首页';
        this.pageDesc ="这里是首页 显示 主体内容"
      } else if(event.url == '/stock'){
        this.pageTitle = '股票管理';
        this.pageDesc ="股票管理-table"
      }
    })
  }

  ngOnInit() {
  }

}
